/*  
 * @(#) BaseDao.java Create on 2012-5-8 下午3:10:12   
 *   
 * Copyright 2012 by xl.   
 */

package cn.com.common.base.dao;

import java.util.List;
import java.util.Map;

import org.springframework.jdbc.core.RowMapper;

import cn.com.common.base.bean.PageBean;

/**
 * 
 * @author zhanghongliang
 * @date 2012-5-8
 */
public interface BaseDao {
	public <T> T get(long id, Class<T> clazz) throws Exception;

	public <T> T get(long id, RowMapper<T> row, String tableName) throws Exception;

	public <T> T executeGet(String sql, RowMapper<T> row, Object... objs) throws Exception;

	public <T> T executeGet(String sql, Class<T> clazz, Object... objs) throws Exception;

	public long insert(Object obj, boolean generatedFlag) throws Exception;

	public long insert(Map<String, Object> params, boolean generatedFlag) throws Exception;

	public long executeInsert(String sql, Map<String, Object> params, boolean generatedFlag) throws Exception;

	public long executeInsert(final String sql, List<Object> params, boolean generatedFlag) throws Exception;

	public int update(Object obj) throws Exception;

	public int updateNotNull(Object obj) throws Exception;

	public int executeUpdate(String sql, Map<String, Object> parmas) throws Exception;

	public int executeUpdate(String sql, List<Object> params) throws Exception;

	public int delete(Object obj) throws Exception;

	public <T> List<T> list(Object obj, Class<T> clazz) throws Exception;

	public <T> List<T> list(Object obj, RowMapper<T> rowMapper) throws Exception;

	public <T> List<T> list(Map<String, Object> params, Class<T> clazz) throws Exception;

	public <T> List<T> list(Map<String, Object> params, RowMapper<T> rowMapper) throws Exception;

	public <T> List<T> queryForList(String sql, Map<String, Object> params, Class<T> clazz) throws Exception;

	public <T> List<T> executeQueryForList(String sql, Map<String, Object> params, RowMapper<T> rowMapper) throws Exception;

	public <T> List<T> executeQueryForList(String sql, Map<String, Object> params, RowMapper<T> rowMapper, int pageSize, int pageNow) throws Exception;

	public <T> List<T> executeQueryForList(String sql, List<Object> params, RowMapper<T> rowMapper, int pageNow, int pageSize) throws Exception;

	public long queryForLong(Object obj) throws Exception;

	public long queryForLong(Map<String, Object> params) throws Exception;

	public long executeQueryForLong(String sql, Map<String, Object> params) throws Exception;

	public long executeQueryForLong(String sql, List<Object> params) throws Exception;

	public <T> PageBean<T> getPageBean(Object obj, Class<T> clazz) throws Exception;

	public <T> PageBean<T> getPageBean(Map<String, Object> params, Class<T> clazz) throws Exception;

	public <T> PageBean<T> getPageBean(Map<String, Object> params, RowMapper<T> rowMapper) throws Exception;

	public <T> PageBean<T> queryForPage(String sql, String sqlCount, Map<String, Object> params, RowMapper<T> rowMapper, int pageNow, int pageSize) throws Exception;

	public <T> PageBean<T> queryForPage(String sql, String sqlCount, List<Object> params, Class<T> clazz, int pageNow, int pageSize) throws Exception;

	public <T> PageBean<T> queryForPage(String sql, String sqlCount, List<Object> params, RowMapper<T> rowMapper, int pageNow, int pageSize) throws Exception;
}
